<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>返回一个字符串缓冲区的信息</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="ref.fileinfo.html">« Fileinfo 函数</a></li>
      <li style="float: right;"><a href="function.finfo-close.html">finfo_close »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.fileinfo.html">Fileinfo 函数</a></li>
    <li>返回一个字符串缓冲区的信息</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.finfo-buffer" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">finfo_buffer</h1>
  <h1 class="refname">finfo::buffer</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL fileinfo &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">finfo_buffer</span> -- <span class="refname">finfo::buffer</span> &mdash; <span class="dc-title">返回一个字符串缓冲区的信息</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.finfo-buffer-description">
  <h3 class="title">说明</h3>
  <p class="para">过程化风格</p>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><a href="finfo.buffer.html" class="methodname">finfo_buffer</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="class.finfo.html" class="type finfo">finfo</a></span> <code class="parameter">$finfo</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = <strong><code>FILEINFO_NONE</code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">?</span><span class="type"><span class="type">resource</span><span class="type"></span></span> <code class="parameter">$context</code><span class="initializer"> = <strong><code>null</code></strong></span></span><br>): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>

  <p class="para rdfs-comment">面向对象风格</p>
  <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="finfo.buffer.html" class="methodname">finfo::buffer</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$string</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = <strong><code>FILEINFO_NONE</code></strong></span></span>, <span class="methodparam"><span class="type">?</span><span class="type"><span class="type">resource</span><span class="type"></span></span> <code class="parameter">$context</code><span class="initializer"> = <strong><code>null</code></strong></span></span>): <span class="type"><span class="type">string</span>|<span class="type"><span class="type false">false</span></span></span></div>


  <p class="para rdfs-comment">
    本函数用来获取字符串中二进制数据的信息。
  </p>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.finfo-buffer-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt>
<code class="parameter">finfo</code></dt>

     <dd>

      <p class="para">经 <span class="function"><a href="function.finfo-open.html" class="function">finfo_open()</a></span> 返回的 <span class="classname"><a href="class.finfo.html" class="classname">finfo</a></span> 实例。</p>
     </dd>

    
    
     <dt>
<code class="parameter">string</code></dt>

     <dd>

      <p class="para">
       要检查的文件内容。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">flags</code></dt>

     <dd>

      <p class="para">
       一个 <a href="fileinfo.constants.html" class="link">Fileinfo
       常量 </a> 或多个 <a href="fileinfo.constants.html" class="link">Fileinfo 常量 </a> 进行逻辑或运算。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">context</code></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.finfo-buffer-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回 <code class="parameter">string</code> 参数所指定内容的类型描述。
   发生错误时返回 <strong><code>false</code></strong> 。
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.finfo-buffer-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.1.0</td>
 <td>
  <code class="parameter">finfo</code> 参数现在接受 <span class="classname"><a href="class.finfo.html" class="classname">finfo</a></span>
  实例，之前接受 <a href="language.types.resource.html" class="link">资源(resource)</a>。
 </td>
</tr>

     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">context</code> 现在可以为 null。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.finfo-buffer-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2133">
    <p><strong>示例 #1 <span class="function"><a href="finfo.buffer.html" class="function">finfo_buffer()</a></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$finfo&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">finfo</span><span style="color: #007700">(</span><span style="color: #0000BB">FILEINFO_MIME</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">$finfo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">buffer</span><span style="color: #007700">(</span><span style="color: #0000BB">$_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">"script"</span><span style="color: #007700">])&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>以上例程的输出类似于：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
application/x-sh; charset=us-ascii
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.finfo-buffer-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="finfo.file.html" class="function" rel="rdfs-seeAlso">finfo_file()</a> - 别名 finfo_file()</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>